<%-- 
    Document   : Assign Poll Creator
    Created on : 9/08/2011, 2:13:47 PM
    UserType   : Poll Admin
    Author     : Mamdouh Alharbi 4194289
    
--%>

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ include file="../header.jsp" %>

    <div id="content-container">
        <div id="content"> 
            <br/><br/>
            <div id = "admin-poll">
           <%-- <button onclick="assign(${polls.getCreatorID},${polls.getID()})">Assign</button>--%>
           <table class="polladmintable">
               <tr>
                   <th>ID</th>
                   <th>Name</th>
                   <th>Email</th>
                   <th>Assign to poll</th>
               </tr>
               <c:choose>
                   <c:when test="${pollCreatorDetail.isEmpty()}">
                       <tr>
                           <td colspan="4"><font color="red">There are no poll creators</font></td>
                       </tr>
                   </c:when>
                   <c:otherwise>
                         <c:forEach items="${pollCreatorDetail}" var="pollCreatorDetail">
                                    <tr>
                                        <td>${pollCreatorDetail.getPollCreatorID()}</td>
                                        <td>${pollCreatorDetail.getCreatorName()}</td>
                                        <td>${pollCreatorDetail.getEmail()}</td>
                                        <td><button onclick="assign(${pollCreatorDetail.getPollCreatorID()},<%= request.getParameter("id") %>)">Assign</button></td>
                                    </tr>
                          </c:forEach>
                  </c:otherwise>
               </c:choose>
           </table>
           <br/>
           <center> 
               <font color="green"> <c:out value="${assigned}"></c:out></font>
           </center>
            </div>
            </div>	
        </div>
         
<%@ include file="../footer.jsp" %>

<script language="JavaScript">
    function assign(cid,pid){
        window.location="assignPollCreator.html?cid="+cid+"&pid="+pid;
    }
</script>

<style>
    #admin-poll { 
        padding-left: 40px;
    }
    #master-poll { 
        padding-left: 40px;
    }
    #creator-poll {
        padding-left: 40px;
    }
    
    .polladmintable {
    font-family:"Trebuchet MS", Arial, Helvetica, sans-serif;
    width:92%;
    border:1px solid #009933;
    text-align:center;
    }
    .polladmintable td, .polladmintable th .polladmintable tr {
    font-size:1em;    
    border:1px solid #009933;
    padding:3px 7px 2px 17px;
    }
    .polladmintable th {
    font-size:1.1em;
    text-align:center;
    padding-top:5px;
    padding-bottom:4px;
    background-color:#008833;
    color:#ffffff;
    }
</style>

